<template>
  <view class="my-message">
    <uni-list>
      <uni-list :border="true" v-for="(item, index) in messageList" :key="index">
          <!-- 显示圆形头像，note是最后一条私信记录 -->
          <uni-list-chat v-if="item.notRead == 0" :avatar-circle="true" :title="item.username" :avatar="item.photo" :note="item.note" :time="item.time" ></uni-list-chat>
          <!-- 右侧带角标，note是新消息提醒 -->
          <uni-list-chat v-else :avatar-circle="true" :title="item.username" :avatar="item.photo" note="您有新的消息" :time="item.time" :badge-text="item.notRead"></uni-list-chat>
      </uni-list>
    </uni-list>
  </view>
</template>

<script>
import {uniList, uniListChat, uniIcons} from '@dcloudio/uni-ui'
export default {
  name: 'my-message',
  components: {
    uniList,
    uniListChat,
    uniIcons
  },
  data() {
    return {
    }
  }
}
</script>

<style lang='scss'>
page {
  background-color: #f5f5f5;
}
</style>
